import { createRouter, createWebHistory } from 'vue-router'
import HomeView from '../views/HomeView.vue'
import NovelIndex from '@/views/novel/index.vue';
import NovelReader from '@/views/novel/reader.vue';

const router = createRouter({
  history: createWebHistory(import.meta.env.BASE_URL),
  routes: [
    {
      path: '/',//首页
      name: 'home',
      component: HomeView,
    },
    {
      path: '/movie',//影视
      name: 'movies',
      // route level code-splitting
      // this generates a separate chunk (About.[hash].js) for this route
      // which is lazy-loaded when the route is visited.
      component: () => import('../views/movie/index.vue'),
      redirect: '/movie/moviePage/0',
      children: [
        {
          path: '/movie/moviePage/:type',//影视页面
          name: 'moviePage',
          component: () => import('../views/movie/moviePage.vue'),
        },
        {
          path: '/movie/details/:id',//详情
          name: 'details',
          component: () => import('../views/movie/details/movieDetails.vue')
        },
        {
          path: '/movie/details/play/:id',//播放
          name: 'play',
          component: () => import('../views/movie/details/moviePlaye.vue')
        }
      ]
    },
    {
      path: '/notes',//笔记
      name: 'notes',
      component: () => import('../views/notes/index.vue'),
    },
    {
      path: '/fileShare',//文件共享
      name: 'fileShare',
      component: () => import('../views/fileShare/index.vue')
    },
    {
      path: '/novel',
      name: 'NovelIndex',
      component: NovelIndex
    },
    {
      path: '/novel/reader/:novelId',
      name: 'NovelReader',
      component: NovelReader,
      props: true
    }
  ],
})

export default router
